gdk: Avoid synthetic motion confusion
authorMatthias Clasen <mclasen@redhat.com>
Thu, 22 Apr 2021 23:51:17 +0000 (19:51 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 23 Apr 2021 01:09:54 +0000 (21:09 -0400)
Don't emit a synthetic motion event on a surface
that is grab-shadowed by a popup. This has been
known to confuse GTK, at times.

Fixes: #3439
gdk/gdksurface.c

index ef6464c43a82412a61c8983b2fd44465061dd981..589dc4e10c98206ebb64575813c4488ef39173ab 100644 (file)
@@ -2443,6 +2443,7 @@ gdk_surface_ensure_motion (GdkSurface *surface)
   GdkEvent *event;
   double x, y;
   GdkModifierType state;
+  GdkSurface *grab_surface;
 
   if (!surface->request_motion)
     return;
@@ -2459,6 +2460,12 @@ gdk_surface_ensure_motion (GdkSurface *surface)
   if (!gdk_surface_get_device_position (surface, device, &x, &y, &state))
     return;
 
+  if (gdk_device_grab_info (display, device, &grab_surface, NULL))
+    {
+      if (grab_surface != surface)
+        return;
+    }
+
   event = gdk_motion_event_new (surface,
                                 device,
                                 NULL,